package com.pattern.structure.proxy;

/**
 * @author yangguanzan
 * @date 3/31/22
 * @description
 */
public class SubjectProxy implements BaseSubject {
    private BaseSubject subject;
    public SubjectProxy(BaseSubject subject) {
        this.subject = subject;
    }

    @Override
    public void request() {
        preRequest();
        this.subject.request();
        postRequest();
    }

    public void preRequest() {
        System.out.println("访问真实主题之前的预处理。");
    }
    public void postRequest() {
        System.out.println("访问真实主题之后的后续处理。");
    }
}
